X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/38c7d3f9eb7d63937c6654ff5dd6046ce02dd59c..b587e9d8e0cc5eb1edf972fd3b644704441e5289:/Super%20Polarity/Actors/Bullet.cs diff --git a/Super Polarity/Actors/Bullet.cs b/Super Polarity/Actors/Bullet.cs index 6862e69..d20289c 100644 --- a/Super Polarity/Actors/Bullet.cs +++ b/Super Polarity/Actors/Bullet.cs @@ -10,8 +10,9 @@ namespace SuperPolarity class Bullet : Actor { protected ParticleEngine particleEngine; + public int Power; - public Bullet(Game newGame) + public Bullet(SuperPolarity newGame) : base(newGame) { } @@ -24,6 +25,12 @@ namespace SuperPolarity public override void Initialize(Texture2D texture, Vector2 position) { base.Initialize(texture, position); + BoxDimensions.X = 10; + BoxDimensions.Y = 10; + BoxDimensions.W = 10; + BoxDimensions.Z = 10; + MaxVelocity = 8; + InitBox(); particleEngine = ParticleEffectFactory.CreateBullet(position); } @@ -32,7 +39,10 @@ namespace SuperPolarity Velocity.X = (float)(MaxVelocity * Math.Cos(Angle)); Velocity.Y = (float)(MaxVelocity * Math.Sin(Angle)); + Power = 1; + Position += Velocity; + UpdateBox(); particleEngine.Update(); particleEngine.EmitterLocation = Position; @@ -43,5 +53,28 @@ namespace SuperPolarity base.Draw(spriteBatch); particleEngine.Draw(spriteBatch); } + + public override void Collide(Actor other, Rectangle collision) + { + if (Dying) { return; } + if (other.GetType().IsAssignableFrom(typeof(StandardShip))) + { + Die(); + return; + } + } + + protected override void Die() + { + ActorManager.CheckOut(this); + Renderer.CheckOut(this); + Parent.Children.Remove(this); + } + + public override void CleanUp() + { + base.CleanUp(); + this.particleEngine = null; + } } }